package cn.tydy.service.user;



import cn.tydy.dao.BaseDao;
import cn.tydy.dao.user.UserMapper;
import cn.tydy.pojo.User;
import com.mysql.jdbc.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;


@Service("userService")
public class UserServiceImpl implements UserService{
    @Resource(name = "userMapper")

    private UserMapper userMapper;

    @Override
    public List<User> listUserAll() {
        return userMapper.listUserAll();
    }

    @Override
    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public User login(String userCode, String userPassword) {

        return userMapper.login(userCode,userPassword);
    }

    @Override
    public User getLoginUser(Connection connection, String userCode)
     	{
           return userMapper.getLoginUser(connection,userCode);
        }

    @Override
    public int add(User user) {
        return userMapper.add(user);
    }

    @Override
    public int deleteUserById(Integer delId) {
        return userMapper.deleteUserById(delId);
    }

    @Override
    public User showUser(Integer delId) {
        return userMapper.showUser(delId);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public boolean checkUserCode(String userCode) {
        if (userMapper.checkUserCode(userCode)){
            return true;//表示存在
        }else{
            return false;//表示不存在
        }

    }


}
